package cn.xspace.wnx.activity;

import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;

import com.xspace.android.xafcommon.base.BaseActivity;
import com.xspace.android.xafcommon.util.LogUtil;
import com.xspace.android.xafcommon.util.T;

import cn.xspace.wnx.R;
import cn.xspace.wnx.fragment.WnxMainFragment;

/**
 * Created by liuchen on 2016/10/8.
 */

public class WnxMainActivity extends BaseActivity {
    private static final String TAG = "WnxMainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d(TAG, "onCreate");
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void initView() {
        Log.d(TAG, "initView");
        setContentView(R.layout.activity_fragment);
        getSupportFragmentManager().beginTransaction().add(R.id.container, WnxMainFragment.newInstance()).commit();
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    private long mBackPressedTime;

    @Override
    public void onBackPressed() {
        LogUtil.d("wubaojie>>>onBackPressed: ");
        long curTime = SystemClock.uptimeMillis();
        if ((curTime - mBackPressedTime) < (3 * 1000)) {
            finish();
//            System.exit(0);// 退出程序
        } else {
            mBackPressedTime = curTime;
            T.showSingleL(getString(R.string.exit_confirm));
        }
    }


}
